home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / pctj0487.arc / CE_CONIO.ASM < prev    next >
Assembly Source File  |  1987-02-02  |  2KB  |  54 lines

  1. ;=====================================================================
  2. ; General-purpose console I/O routines
  3. ;   For Break Handler (BRK_TEST) & Critical Error Handler (CE_TEST)
  4. ;=====================================================================
  5.  
  6. ;---------------------------------------------------------------------
  7. ; GET_KEY
  8. ; Clears the keyboard buffer, waits for a key and returns it in AL.
  9. ; Returns -(key) for extended ASCII keystrokes
  10. ;---------------------------------------------------------------------
  11. get_key  proc    near
  12.          mov     ah,0cH        ;clear kb buffer
  13.          mov     al,07H        ;console input function
  14.          int     21H
  15.  
  16.          cmp     al,0          ;extended ASCII?
  17.          jne     gk_exit
  18.  
  19.          mov     ah,07H        ;get the extended ASCII code
  20.          int     21H
  21.          neg     al
  22. gk_exit: ret
  23. get_key  endp
  24.  
  25. ;---------------------------------------------------------------------
  26. ; DISP_MSG
  27. ; This function displays an ASCIIZ message at the current cursor pos
  28. ; DS:DX = address of start of the string
  29. ; Uses BIOS services only.
  30. ;---------------------------------------------------------------------
  31. disp_msg proc    near
  32.          mov     si,dx
  33. dm_10:   lodsb
  34.          cmp     al,0          ;done with the string?
  35.          je      dm_20         ; yes, exit
  36.          mov     bh,0          ; no, select video page 0
  37.          mov     ah,0eH        ;     use write_tty service
  38.          int     10H           ;     to display a character
  39.          jmp     dm_10         ; loop back for next character
  40. dm_20:
  41.          ret
  42. disp_msg endp
  43.  
  44. ;---------------------------------------------------------------------
  45. ; BEEP
  46. ; sounds the bell by printing an ASCII 07H via BIOS write_tty service
  47. ;---------------------------------------------------------------------
  48. beep     proc    near
  49.          mov     al,07H
  50.          mov     ah,0eH   ;BIOS write_tty service
  51.          int     10H
  52.          ret
  53. beep     endp
  54.